﻿package 
{
    import EipBar.*;
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;

    public class EipBar extends EipbarBase
    {
        private var _onSendEip:Function;
        private var _btnList:Array;

        public function EipBar()
        {
            this._onSendEip = new Function();
            this.renderEip();
            return;
        }// end function

        public function set onSendEip(param1:Function) : void
        {
            this._onSendEip = param1;
            return;
        }// end function

        public function clear() : void
        {
            var _loc_3:Object = null;
            var _loc_1:* = this._btnList.length;
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1)
            {
                
                _loc_3 = this._btnList[_loc_2];
                _loc_3.btn.removeEventListener(MouseEvent.CLICK, _loc_3.eipClick);
                _loc_3.btn.removeEventListener(MouseEvent.MOUSE_OVER, _loc_3.eipMouseOver);
                _loc_3.btn.removeEventListener(MouseEvent.MOUSE_OUT, _loc_3.eipMouseOut);
                _loc_3.btn.removeChild(_loc_3.eip);
                _loc_3.eip = null;
                removeChild(_loc_3.btn);
                _loc_3.btn = null;
                _loc_2 = _loc_2 + 1;
            }
            this._btnList = null;
            return;
        }// end function

        private function renderEip() : void
        {
            var _loc_2:Object = null;
            var _loc_3:EipBtn = null;
            var _loc_4:int = 0;
            var _loc_5:String = null;
            var _loc_6:Class = null;
            var _loc_7:MovieClip = null;
            this._btnList = [];
            var _loc_1:int = 0;
            while (_loc_1 < 35)
            {
                
                _loc_2 = {};
                _loc_3 = new EipBtn();
                _loc_3.x = 2 + (_loc_3.width + 7) * (_loc_1 - 7 * Math.floor(_loc_1 / 7));
                _loc_3.y = 2 + Math.floor(_loc_1 / 7) * (_loc_3.height + 7);
                _loc_3._Black.alpha = 0;
                _loc_3.buttonMode = true;
                addChild(_loc_3);
                _loc_4 = _loc_1 + 1;
                _loc_5 = "eip" + _loc_4;
                _loc_6 = getDefinitionByName(_loc_5) as Class;
                _loc_7 = new _loc_6 as MovieClip;
                _loc_3.addChild(_loc_7);
                _loc_2.eip = _loc_7;
                _loc_2.btn = _loc_3;
                _loc_2.name = _loc_5;
                _loc_2.id = _loc_4;
                _loc_2.eipClick = this.eipClick(_loc_2);
                _loc_2.eipMouseOver = this.eipMouseOver(_loc_2);
                _loc_2.eipMouseOut = this.eipMouseOut(_loc_2);
                _loc_2.btn.addEventListener(MouseEvent.CLICK, _loc_2.eipClick);
                _loc_2.btn.addEventListener(MouseEvent.MOUSE_OVER, _loc_2.eipMouseOver);
                _loc_2.btn.addEventListener(MouseEvent.MOUSE_OUT, _loc_2.eipMouseOut);
                this._btnList.push(_loc_2);
                _loc_1 = _loc_1 + 1;
            }
            return;
        }// end function

        private function eipClick(param1:Object) : Function
        {
            var data:* = param1;
            var func:* = function (event:MouseEvent) : void
            {
                _onSendEip(data);
                return;
            }// end function
            ;
            return func;
        }// end function

        private function eipMouseOver(param1:Object) : Function
        {
            var data:* = param1;
            var func:* = function (event:MouseEvent) : void
            {
                data.btn._Black.alpha = 1;
                return;
            }// end function
            ;
            return func;
        }// end function

        private function eipMouseOut(param1:Object) : Function
        {
            var data:* = param1;
            var func:* = function (event:MouseEvent) : void
            {
                data.btn._Black.alpha = 0;
                return;
            }// end function
            ;
            return func;
        }// end function

    }
}
